package com.jh.user.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * @author zhugu
 * 2018/11/28 18:43
 */
@Entity
@Table(name = "t_fast_silver_pic_path")
public class FastSilverPicPath implements Serializable {
    private static final long serialVersionUID = 7940437158156088705L;

    @Id
    @Column(name = "id", length = 20)
    @GeneratedValue(strategy = GenerationType.AUTO)
    private long id;

    /**
     * 用户id
     */
    @Column(name = "user_id", length = 10)
    private long userId;

    /**
     * 门头照
     */
    @Column(name = "merchant_head", length = 127)
    private String merchantHead;

    /**
     * 收银台照
     */
    @Column(name = "merchant_chech", length = 127)
    private String merchantChech;

    /**
     * 经营场所照
     */
    @Column(name = "other_photo_three", length = 127)
    private String otherPhotoThree;

    /**
     * 法人身份证正面照
     */
    @Column(name = "identity_face", length = 127)
    private String identityFace;

    /**
     * 法人身份证反面照
     */
    @Column(name = "identity_back", length = 127)
    private String identityBack;

    /**
     * 开户许可证照
     */
    @Column(name = "business_card", length = 127)
    private String businessCard;

    /**
     * 营业执照照
     */
    @Column(name = "business", length = 127)
    private String business;

    /**
     * 结算人身份证正面照
     */
    @Column(name = "identity_face_copy", length = 127)
    private String identityFaceCopy;

    /**
     * 结算人身份证反面照
     */
    @Column(name = "identity_back_copy", length = 127)
    private String identityBackCpoy;

    /**
     * 手持身份证照片
     */
    @Column(name = "identity_body", length = 127)
    private String identityBody;

    /**
     * 非法人对私授权函
     */
    @Column(name = "other_photo_four", length = 127)
    private String otherPhotoFour;

    /**
     * 租房合同
     */
    @Column(name = "other_photo_two", length = 127)
    private String otherPhotoTwo;

    /**
     * 其他资料
     */
    @Column(name = "other_photo", length = 127)
    private String otherPhoto;

    /**
     * 内部前台照片
     */
    @Column(name = "first_pic_photo")
    private String firstPhoto;

    /**
     * 银行卡正面照片
     */
    @Column(name = "bank_front_photo")
    private String bankFrontPhoto;

    /**
     * 银行卡反面照片
     */
    @Column(name = "bank_reverse_photo")
    private String bankReversePhoto;

    /**
     * 商户场景照片
     */
    @Column(name = "mch_scene_photo")
    private String mchScenePhoto;

    /**
     * 商户总分店关系证明
     */
    @Column(name = "relationship_photo")
    private String relationshipPhoto;

    /**
     * 商户增值协议
     */
    @Column(name = "merchant_photo")
    private String merchantPhoto;

    @Column(name = "update_time")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @Column(name = "createTime")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public String getMerchantHead() {
        return merchantHead;
    }

    public void setMerchantHead(String merchantHead) {
        this.merchantHead = merchantHead;
    }

    public String getMerchantChech() {
        return merchantChech;
    }

    public void setMerchantChech(String merchantChech) {
        this.merchantChech = merchantChech;
    }

    public String getOtherPhotoThree() {
        return otherPhotoThree;
    }

    public void setOtherPhotoThree(String otherPhotoThree) {
        this.otherPhotoThree = otherPhotoThree;
    }

    public String getIdentityFace() {
        return identityFace;
    }

    public void setIdentityFace(String identityFace) {
        this.identityFace = identityFace;
    }

    public String getIdentityBack() {
        return identityBack;
    }

    public void setIdentityBack(String identityBack) {
        this.identityBack = identityBack;
    }

    public String getBusinessCard() {
        return businessCard;
    }

    public void setBusinessCard(String businessCard) {
        this.businessCard = businessCard;
    }

    public String getBusiness() {
        return business;
    }

    public void setBusiness(String business) {
        this.business = business;
    }

    public String getIdentityFaceCopy() {
        return identityFaceCopy;
    }

    public void setIdentityFaceCopy(String identityFaceCopy) {
        this.identityFaceCopy = identityFaceCopy;
    }

    public String getIdentityBackCpoy() {
        return identityBackCpoy;
    }

    public void setIdentityBackCpoy(String identityBackCpoy) {
        this.identityBackCpoy = identityBackCpoy;
    }

    public String getIdentityBody() {
        return identityBody;
    }

    public void setIdentityBody(String identityBody) {
        this.identityBody = identityBody;
    }

    public String getOtherPhotoFour() {
        return otherPhotoFour;
    }

    public void setOtherPhotoFour(String otherPhotoFour) {
        this.otherPhotoFour = otherPhotoFour;
    }

    public String getOtherPhotoTwo() {
        return otherPhotoTwo;
    }

    public void setOtherPhotoTwo(String otherPhotoTwo) {
        this.otherPhotoTwo = otherPhotoTwo;
    }

    public String getOtherPhoto() {
        return otherPhoto;
    }

    public void setOtherPhoto(String otherPhoto) {
        this.otherPhoto = otherPhoto;
    }

    public String getFirstPhoto() {
        return firstPhoto;
    }

    public void setFirstPhoto(String firstPhoto) {
        this.firstPhoto = firstPhoto;
    }

    public String getBankFrontPhoto() {
        return bankFrontPhoto;
    }

    public void setBankFrontPhoto(String bankFrontPhoto) {
        this.bankFrontPhoto = bankFrontPhoto;
    }

    public String getBankReversePhoto() {
        return bankReversePhoto;
    }

    public void setBankReversePhoto(String bankReversePhoto) {
        this.bankReversePhoto = bankReversePhoto;
    }

    public String getMchScenePhoto() {
        return mchScenePhoto;
    }

    public void setMchScenePhoto(String mchScenePhoto) {
        this.mchScenePhoto = mchScenePhoto;
    }

    public String getRelationshipPhoto() {
        return relationshipPhoto;
    }

    public void setRelationshipPhoto(String relationshipPhoto) {
        this.relationshipPhoto = relationshipPhoto;
    }

    public String getMerchantPhoto() {
        return merchantPhoto;
    }

    public void setMerchantPhoto(String merchantPhoto) {
        this.merchantPhoto = merchantPhoto;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof FastSilverPicPath)) return false;
        FastSilverPicPath that = (FastSilverPicPath) o;
        return getId() == that.getId() &&
                getUserId() == that.getUserId() &&
                Objects.equals(getMerchantHead(), that.getMerchantHead()) &&
                Objects.equals(getMerchantChech(), that.getMerchantChech()) &&
                Objects.equals(getOtherPhotoThree(), that.getOtherPhotoThree()) &&
                Objects.equals(getIdentityFace(), that.getIdentityFace()) &&
                Objects.equals(getIdentityBack(), that.getIdentityBack()) &&
                Objects.equals(getBusinessCard(), that.getBusinessCard()) &&
                Objects.equals(getBusiness(), that.getBusiness()) &&
                Objects.equals(getIdentityFaceCopy(), that.getIdentityFaceCopy()) &&
                Objects.equals(getIdentityBackCpoy(), that.getIdentityBackCpoy()) &&
                Objects.equals(getIdentityBody(), that.getIdentityBody()) &&
                Objects.equals(getOtherPhotoFour(), that.getOtherPhotoFour()) &&
                Objects.equals(getOtherPhotoTwo(), that.getOtherPhotoTwo()) &&
                Objects.equals(getOtherPhoto(), that.getOtherPhoto()) &&
                Objects.equals(getFirstPhoto(), that.getFirstPhoto()) &&
                Objects.equals(getBankFrontPhoto(), that.getBankFrontPhoto()) &&
                Objects.equals(getBankReversePhoto(), that.getBankReversePhoto()) &&
                Objects.equals(getMchScenePhoto(), that.getMchScenePhoto()) &&
                Objects.equals(getRelationshipPhoto(), that.getRelationshipPhoto()) &&
                Objects.equals(getMerchantPhoto(), that.getMerchantPhoto()) &&
                Objects.equals(getUpdateTime(), that.getUpdateTime()) &&
                Objects.equals(getCreateTime(), that.getCreateTime());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), getUserId(), getMerchantHead(), getMerchantChech(), getOtherPhotoThree(), getIdentityFace(), getIdentityBack(), getBusinessCard(), getBusiness(), getIdentityFaceCopy(), getIdentityBackCpoy(), getIdentityBody(), getOtherPhotoFour(), getOtherPhotoTwo(), getOtherPhoto(), getFirstPhoto(), getBankFrontPhoto(), getBankReversePhoto(), getMchScenePhoto(), getRelationshipPhoto(), getMerchantPhoto(), getUpdateTime(), getCreateTime());
    }



    public long validFSilverPicPath() {
        long count = 0;
        if (StringUtils.isEmpty(getMerchantHead())) {
            count++;
        }
        if (StringUtils.isEmpty(getMerchantChech())) {
            count++;
        }
        if (StringUtils.isEmpty(getOtherPhotoThree())) {
            count++;
        }
        if (StringUtils.isEmpty(getIdentityFace())) {
            count++;
        }
        if (StringUtils.isEmpty(getIdentityBack())) {
            count++;
        }
        if (StringUtils.isEmpty(getBusinessCard())) {
            count++;
        }
        if (StringUtils.isEmpty(getBusiness())) {
            count++;
        }
        if (StringUtils.isEmpty(getIdentityFaceCopy())) {
            count++;
        }
        if (StringUtils.isEmpty(getIdentityBackCpoy())) {
            count++;
        }
        if (StringUtils.isEmpty(getIdentityBody())) {
            count++;
        }
        if (StringUtils.isEmpty(getOtherPhotoFour())) {
            count++;
        }
        return count;
    }
}
